<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
    <%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<jsp:include page="/common/commonCss.jsp"/>
<jsp:include page="/common/commonJs.jsp"/>
<script src="${basePath }resources/scmPurOrder/scmPurOrder.js"></script>
<title>嘉童游乐中心-采购订单清单详情</title>

	<SCRIPT type="text/javascript">
	var basePath ='${basePath}';
	$(document).ready(function(){
		purOrderPrdDiv('${pkPurordId}','${oldSuppLyId}');
	}); 

	function process_sub(flag){
		var i=0;
		$("#tablesupPrd tr:not(:first)").each(function(){
			i++;
		});
		if(i==0 && flag != 2)
			{
				alertInfo("此项申请商品已被删除，无法提交请退回！");
				return;
			}
		 var msgText ="提交";
		if(flag == 1){
			path = "${basePath}scmInvocing/scmPurOrder/approvalProcessPurOrder.shtml";
		}else{
			msgText ="退回";
			path =  "${basePath}scmInvocing/scmPurOrder/approvalProcessPurOrderExt.shtml";
		}
		 $.messager.confirm('提示', '确认'+msgText+'吗?', function(r) {
				if(r){
		$("#process_form_id").attr("action",path);
		$("#process_form_id").submit();
				}
		 });
		/*  var url ='${basePath }scmInvocing/scmPurOrder/checkScmSupExist.shtml?supplyId=${oldSuppLyId}';
			$.ajax({
				   url: url,
				   type: 'POST',
				      async:false, 
				   success:function(msg){
						if ( msg == "2") {
							//alertInfo("供应商不存在，不能提交审批！");
						}else if(msg == "1"){
							var path ="";
							if(flag == 1){
								path = "${basePath}scmInvocing/scmPurOrder/approvalProcessPurOrder.shtml";
							}else{
								path =  "${basePath}scmInvocing/scmPurOrder/approvalProcessPurOrderExt.shtml";
							}
							$("#process_form_id").attr("action",path);
							$("#process_form_id").submit();
						}else{
							alertInfo("提交失败！");
						}
				   }
			}); */

	}
	</SCRIPT>
</head>
<body class="bg">
<div class="content m_auto">
	<div class="content_l mt10">
    	<ul>
         <shiro:hasPermission name="scmInvocing/productInfo/forwardToProductInfo.shtml">
    				  <li><a href="${basePath}scmInvocing/productInfo/forwardToProductInfo.shtml"><i class="nav_icon_b"></i><br>商品信息</a></li>
    		</shiro:hasPermission>
    		 <shiro:hasPermission name="scmInvocing/countUnit/forwardToUnitInfo.shtml">
    		 		<li><a href="${basePath}scmInvocing/countUnit/forwardToUnitInfo.shtml"><i class="nav_icon_b"></i><br>单位设置</a></li>
    		 </shiro:hasPermission>
    		 <shiro:hasPermission name="scmInvocing/supplier/forwardToSupply.shtml">
    		 		   <li><a href="${basePath}scmInvocing/supplier/forwardToSupply.shtml"><i class="nav_icon_a"></i><br>供应商信息</a></li>
    		 </shiro:hasPermission>
    		  <shiro:hasPermission name="scmInvocing/priceManager/forwardToList.shtml">
    		 		  <li><a href="${basePath}scmInvocing/priceManager/forwardToList.shtml"><i class="nav_icon_f"></i><br>价格管理</a></li>
    		 </shiro:hasPermission>
    		   <shiro:hasPermission name="scmInvocing/scmPurOrder/findInvoPurOrder.shtml">
            	  <li  class="content_hover"><a href="${basePath}scmInvocing/scmPurOrder/findInvoPurOrder.shtml"><i class="nav_icon_b"></i><br>采购订单</a></li>
    		 </shiro:hasPermission>
    		   <shiro:hasPermission name="scmInvocing/scmPayForm/findInvoOrderPay.shtml">
           		   <li><a href="${basePath}scmInvocing/scmPayForm/findInvoOrderPay.shtml"><i class="nav_icon_b"></i><br>付款申请</a></li>
    		 </shiro:hasPermission></ul>
    </div>
    <div class="content_r mt10">
    	<div class="p20">
            <div class="file_single_dl f14 fixed">
                <h1 class=""><font size="+1">采购订单清单</font></h1>
                <hr>
                <dl class="fixed" style="overflow:hidden"> 
                    
                     <c:choose>
		                  <c:when test="${type=='add'}">
		                      <dd><label>采购订单编号：</label></dd>
		                   </c:when>
		                    <c:otherwise>
		                          <dd><label>采购订单编号：</label>${pkPurordId}</dd>
		                     </c:otherwise>
                      </c:choose>
                </dl>
                <hr>
                <dl class="fixed" style="overflow:hidden">
                    <dd><label>制单人：</label>${applyName}</dd>
                    <dd><label>制单单位：</label>${brandName}</dd>
                    <dd>
                    <label>供应商：</label>
                      ${supplyName}
                    </dd>
                </dl>
                <hr>
            </div>
           
            <div class="mt10">
                <h1 class=""><font size="+1">采购商品目录</font></h1>
                     <form action="" id="supPrdForm">
                        <table class="table" id="tablesupPrd">
                            <tr>
                                <th>序号</th>
                                <th>商品编号</th>
                                <th>商品名称</th>
                                <th>商品分类</th>
                                <th>规格</th>
                                <th>单位</th>
                                <th>协议单价(元)</th> 
                                <th>采购数量</th> 
                            </tr>
                             
                             
                        </table>
                        </form>
				<dl class="fixed order_dl">
                         	<!-- <dd><label><b>当前步骤：</b></label>总监审批</dd> -->
							<dd><label><b>处理历史：</b></label>
                        	<dd>
                            <table class="table" >
                                <tr>
                                    <th>时间</th>
                                    <th>处理人</th>
                                    <th>结果</th>
                                    <th>处理意见</th>
                                </tr>
                                 <c:forEach items="${hisWorkFlowList }" var="hisEntity" >
			                        <tr>
	                                    <td style="width:40%">${hisEntity.optTime }</td>
	                                    <td>${hisEntity.optName }</td>
	                                    <td>${hisEntity.result }</td>
	                                      <td title="${hisEntity.advice}">
	                                    <c:if test="${hisEntity.advice != null}">
	                                   	<c:choose>
	                                   		<c:when test="${hisEntity.advice.length()>70}">
	                                   			${hisEntity.advice.substring(0,70)}...
	                                  		 </c:when>
	                                   		<c:otherwise>
	                                    	${hisEntity.advice }
	                                   		</c:otherwise>
	                                    </c:choose>
	                                    </c:if>
	                                    </td>
	                                </tr>
		                        </c:forEach>
                            </table>
                        </dd>
  
            	
            	</dl>
            	<form id="process_form_id" action="${basePath }promotionWorkFlow/approvalProcessPromotionSub.shtml" method="post">
            	<dl class="fixed order_dl">
            	
                        <dd><label class="fl"><b>审批结果：</b></label>
                        	<ul class="ul_radio fl">
                            	<li><input type="radio" class="mr5" name="handleAdviceDes"  value="同意" checked="checked" onclick="javascript:$('#handleAdvice_id').val(1);">同意</li>
                                <li><input type="radio" class="mr5" name="handleAdviceDes" value="不同意" onclick="javascript:$('#handleAdvice_id').val(0);">不同意</li>
                            </ul>
                        </dd>
                        <div class="clear"></div>
                        <dd>
                        	<label class="vt"><b>审批意见：</b></label>
                        	<textarea class="w200 textare" name="handleReason"></textarea></dd>
            	</dl>
                    <div class="btm_btn m10">
                        <dl>
                            <dd><input class="btn" type="button" value="提交" onclick="javascript:process_sub(1)"></dd>
                             <dd><input class="btn" type="button" value="退回" onclick="javascript:process_sub(2)"></dd>
                            <dd><input class="btn" type="button" value="返回" onclick="javascript:window.location.href='${basePath }scmInvocing/scmPurOrder/findInvoPurOrder.shtml'"></dd>
                            
                        </dl>
                    </div>
               <input type="hidden" name="processInstanceId" value="${scmPurOrder.fkFlowinstId }">
               <input type="hidden" name="businessKey" value="${pkPurordId}">
               <input type="hidden" name="handleAdvice" id="handleAdvice_id" value="1"><!-- 1、 同意   2、 不同意  -->
           </form>
            </div>
        </div>
    </div>
</div> 
<div id="hide_loading">
	<div class="loading"></div>    
    <div class="loading_bg"></div>	
</div>
</body>
</html>